Skip to content

Commit 6693cb6

Browse files
committed
feat(v2): updated project setup and applied latest api changes
1 parent 3ba8660 commit 6693cb6

File tree

18 files changed

+10714
-1976
lines changed

18 files changed

+10714
-1976
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ coverage/
55
dist/
66
node_modules/
77
examples/**/node_modules/
8+
example/*.js
9+
scripts/*.js
810

911
test/resources/auth.js
1012
# ignore emitted js

.eslintrc.js

Lines changed: 48 additions & 185 deletions
Original file line numberDiff line numberDiff line change
@@ -1,191 +1,54 @@
11
module.exports = {
2-
parser: '@typescript-eslint/parser',
3-
plugins: ['@typescript-eslint'],
4-
extends: ['airbnb', 'eslint:recommended', 'plugin:@typescript-eslint/recommended'],
5-
env: {
6-
browser: true,
7-
jasmine: true,
8-
jquery: true,
9-
jest: true,
10-
},
11-
globals: {
12-
analytics: true,
13-
},
14-
rules: {
15-
// This block has rules that we either had before, or that I (personal opinion) either didn't
16-
// consider to be important, or not controversial.
17-
'no-console': 'off',
18-
'no-script-url': 'off',
19-
'max-len': 'off',
20-
'no-param-reassign': 'off',
21-
'no-underscore-dangle': 'off',
22-
camelcase: 'off',
23-
'react/jsx-no-target-blank': 'error',
24-
'react/jsx-uses-react': 'error',
25-
'react/jsx-uses-vars': 'error',
26-
'spaced-comment': 'off',
27-
'import/extensions': 'off',
28-
'import/order': 'off',
29-
'import/newline-after-import': 'warn',
30-
'import/prefer-default-export': 'off',
31-
'import/no-extraneous-dependencies': 'off',
32-
'no-restricted-syntax': 'off',
33-
'no-plusplus': 'warn',
34-
'jsx-quotes': 'off',
35-
'react/jsx-curly-brace-presence': 'warn',
36-
'react/destructuring-assignment': 'off',
37-
'react/sort-comp': 'off',
38-
'max-classes-per-file': 'off',
39-
'react/jsx-boolean-value': 'off',
40-
'react/forbid-prop-types': 'off',
41-
'react/jsx-fragments': 'warn',
42-
'@typescript-eslint/ban-ts-comment': 'warn',
43-
'no-nested-ternary': 'warn',
44-
'jsx-a11y/label-has-associated-control': 'warn',
45-
'jsx-a11y/control-has-associated-label': 'warn',
46-
'jsx-a11y/tabindex-no-positive': 'warn',
47-
'operator-assignment': 'off',
48-
'no-restricted-properties': 'warn',
49-
'react/jsx-props-no-spreading': 'off',
50-
'react/jsx-filename-extension': [1, { extensions: ['.tsx', '.jsx'] }],
51-
'react/jsx-curly-newline': 'off',
52-
'@typescript-eslint/no-inferrable-types': 'off',
53-
'@typescript-eslint/no-extra-semi': 'off',
54-
// the base rule is buggy and must be disabled
55-
'no-use-before-define': 'off',
56-
'react/function-component-definition': 'off',
57-
58-
// Formatting where prettier has a different opinion. These should remain off,
59-
// or we'll have two pre-commit hooks that contradict each other.
60-
'object-curly-newline': 'off',
61-
'operator-linebreak': 'off',
62-
'lines-between-class-members': 'off',
63-
'function-paren-newline': 'off',
64-
'implicit-arrow-linebreak': 'off',
65-
'newline-per-chained-call': 'off',
66-
'no-multiple-empty-lines': 'off',
67-
'no-trailing-spaces': 'off',
68-
'react/jsx-wrap-multilines': 'off',
69-
'react/display-name': 'off',
70-
indent: 'off',
71-
'react/jsx-one-expression-per-line': 'off',
72-
'react/jsx-indent': 'off',
73-
74-
// More "modern" JS styles. Some of these would be a lot of work to enabel.
75-
'comma-dangle': 'off',
76-
'arrow-body-style': 'off',
77-
'prefer-object-spread': 'warn',
78-
'prefer-rest-params': 'warn',
79-
'prefer-destructuring': 'off',
80-
'prefer-template': 'warn',
81-
'prefer-arrow-callback': 'off',
82-
83-
// Not sure about this one. We can't easily enable it because we violate it all over the backend
84-
'import/no-import-module-exports': 'off',
85-
86-
// Anything below here I think should really be errors. Turning them into warnings now
87-
// because I can't fix them all at once. In no particular order.
88-
'no-confusing-arrow': 'warn',
89-
'no-useless-constructor': 'warn',
90-
'no-extra-boolean-cast': 'warn',
91-
'no-sequences': 'warn',
92-
quotes: 'warn',
93-
'no-shadow-restricted-names': 'warn',
94-
eqeqeq: 'warn',
95-
'no-prototype-builtins': 'warn',
96-
'no-var': 'warn',
97-
// For typescript, it is recommended to turn this off as it is checked by typescript
98-
'no-undef': 'off',
99-
'array-callback-return': 'warn',
100-
'no-unneeded-ternary': 'warn',
101-
'no-path-concat': 'warn',
102-
'no-case-declarations': 'warn',
103-
'no-useless-return': 'warn',
104-
'no-continue': 'warn',
105-
'no-lonely-if': 'warn',
106-
'default-case': 'warn',
107-
'no-multi-assign': 'warn',
108-
'prefer-const': 'warn',
109-
'no-async-promise-executor': 'warn',
110-
// this gives false positives for typescript enums; enable the corresponding typescript rule instead
111-
'no-shadow': 'off',
112-
'no-useless-escape': 'warn',
113-
'no-else-return': 'off',
114-
'import/no-useless-path-segments': 'off',
115-
'import/no-duplicates': 'warn',
116-
'import/no-mutable-exports': 'warn',
117-
'import/no-dynamic-require': 'warn',
118-
'import/no-self-import': 'off',
119-
'global-require': 'warn',
120-
'object-shorthand': 'warn',
121-
'no-unused-expressions': 'warn',
122-
'dot-notation': 'warn',
123-
'no-await-in-loop': 'warn',
124-
'prefer-promise-reject-errors': 'warn',
125-
'no-restricted-globals': 'warn',
126-
'class-methods-use-this': 'off',
127-
'@typescript-eslint/no-use-before-define': ['off'],
128-
'@typescript-eslint/no-empty-interface': 'warn',
129-
'@typescript-eslint/no-var-requires': 'off',
130-
'@typescript-eslint/no-this-alias': 'warn',
131-
'@typescript-eslint/no-namespace': 'off',
132-
'@typescript-eslint/ban-types': 'warn',
133-
'@typescript-eslint/no-shadow': 'error',
134-
'react/prop-types': 'off',
135-
'react/no-access-state-in-setstate': 'warn',
136-
'react/require-default-props': 'off',
137-
'react/no-unused-prop-types': 'warn',
138-
'react/jsx-no-bind': 'warn',
139-
'react/no-did-update-set-state': 'warn',
140-
'react/no-unused-state': 'warn',
141-
'react/static-property-placement': 'warn',
142-
'react/no-unescaped-entities': 'warn',
143-
'react/no-children-prop': 'warn',
144-
'react/no-direct-mutation-state': 'warn',
145-
'react/default-props-match-prop-types': 'warn',
146-
'react/prefer-stateless-function': 'warn',
147-
'react/jsx-key': 'warn',
148-
'jsx-a11y/no-static-element-interactions': 'warn',
149-
'jsx-a11y/click-events-have-key-events': 'warn',
150-
'jsx-a11y/aria-props': 'warn',
151-
'jsx-a11y/anchor-is-valid': 'warn',
152-
'no-return-assign': 'warn',
153-
'consistent-return': 'warn',
154-
'import/first': 'warn',
155-
'default-param-last': 'warn',
156-
// The following rules seem sensible, but we violate them in so many places that I disable them for now
157-
'import/no-named-as-default': 'warn',
158-
'import/no-cycle': 'warn',
159-
'import/no-named-as-default-member': 'warn',
160-
'import/no-unresolved': 'off',
161-
'padded-blocks': 'off',
162-
'quote-props': 'off'
163-
},
164-
settings: {
165-
'import/parsers': {
166-
'@typescript-eslint/parser': ['.ts', '.tsx'],
167-
},
168-
'import/resolver': {
169-
// "node": {
170-
// "paths": [path.resolve(__dirname, './src')]
171-
// },
172-
typescript: {
173-
project: './tsconfig.json',
2+
'root': true,
3+
'overrides': [
4+
{
5+
'env': {
6+
'node': true,
7+
},
8+
'files': ['**/*.js', '**/*.jsx'],
9+
'plugins': ['node', 'jest', 'prettier'],
10+
'extends': ['airbnb-base', 'plugin:jest/recommended', 'plugin:jest/style', 'prettier'],
11+
'rules': {
12+
'camelcase': 'off',
13+
'import/extensions': 'off',
14+
'no-template-curly-in-string': 'off',
15+
'no-underscore-dangle': 'off',
16+
'prefer-const': 'error',
17+
'prettier/prettier': 'error',
17418
},
17519
},
176-
react: {
177-
createClass: 'createReactClass', // Regex for Component Factory to use,
178-
// default to "createReactClass"
179-
pragma: 'React', // Pragma to use, default to "React"
180-
version: 'detect', // React version. "detect" automatically picks the version you have installed.
181-
// You can also use `16.0`, `16.3`, etc, if you want to override the detected value.
182-
// default to latest and warns if missing
183-
// It will default to "detect" in the future
20+
{
21+
'files': ['*.test.js', '*.test.jsx'],
22+
'rules': {
23+
'jest/expect-expect': 'off',
24+
'jest/no-conditional-expect': 'off',
25+
'jest/no-done-callback': 'off',
26+
'jest/no-standalone-expect': 'off',
27+
'jest/no-try-expect': 'off',
28+
'no-unused-vars': 'off',
29+
},
18430
},
185-
},
186-
parserOptions: {
187-
ecmaFeatures: {
188-
jsx: true,
31+
{
32+
'files': ['**/*.ts', '**/*.tsx'],
33+
'env': {
34+
'node': true,
35+
},
36+
'extends': ['airbnb-typescript/base', 'prettier'],
37+
'parser': '@typescript-eslint/parser',
38+
'parserOptions': {
39+
'project': 'tsconfig.json',
40+
'sourceType': 'module',
41+
},
42+
'plugins': ['eslint-plugin-jsdoc', 'eslint-plugin-import', '@typescript-eslint', 'prettier'],
43+
'rules': {
44+
'@typescript-eslint/naming-convention': 'off',
45+
'@typescript-eslint/no-unused-vars': 'off',
46+
'max-len': 'off',
47+
'no-param-reassign': 'off',
48+
'no-underscore-dangle': 'off',
49+
'prettier/prettier': 'error',
50+
'spaced-comment': ['error', 'always', { 'exceptions': ['*'] }],
51+
},
18952
},
190-
},
53+
],
19154
};

.github/pull_request_template.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
## PR summary
22
<!-- please include a brief summary of the changes in this PR -->
33

4-
**Fixes:** <! -- link to issue -->
54

65
## PR Checklist
76
Please make sure that your PR fulfills the following requirements:

.prettierrc.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
module.exports = {
2+
semi: true,
3+
trailingComma: 'es5',
24
singleQuote: true,
3-
jsxSingleQuote: true,
4-
printWidth: 120,
5+
printWidth: 100,
6+
quoteProps: 'preserve',
57
};

.travis.yml

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
language: node_js
1+
dist: focal
22

3-
# After creating your SDK project from this template repository,
4-
# uncomment this section to enable builds on the appropriate node versions.
5-
# node_js:
6-
# - 12
7-
# - 14
3+
# Remove this if using external Travis
4+
group: beta
5+
6+
language: node_js
7+
node_js:
8+
- 14
9+
- 16
10+
- 18
811

912
# After creating your SDK project from this template repository,
1013
# remove the "echo" command from the "before_install" section below.
@@ -19,32 +22,11 @@ script:
1922
- npm run lint
2023
- npm run check-packages
2124

22-
# After creating your SDK project from this template repository,
23-
# remove this entire "jobs" section as this is only applicable
24-
# to the template repo's travis build.
25-
jobs:
26-
include:
27-
- stage: Run node template build
28-
node_js: 12
29-
- node_js: 14
30-
- stage: Run system test with template
31-
node_js: 14
32-
script:
33-
- >-
34-
if [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then
35-
echo "Running system tests"
36-
git clone https://github.ibm.com/CloudEngineering/sdkgen-systest.git
37-
cd sdkgen-systest
38-
./install_scripts/install_deps_ubuntu.sh
39-
./setup_and_generate.sh -l ibm-node -t $TRAVIS_BRANCH -s
40-
else
41-
echo "Skipping system tests for PR build..."
42-
fi
4325
# To enable semantic-release, uncomment this section.
4426
# deploy:
4527
# - provider: script
4628
# skip_cleanup: true
4729
# script: npx semantic-release
4830
# on:
4931
# node: 14
50-
# branch: main
32+
# branch: main

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
5555
## Enforcement
5656

5757
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58-
reported by contacting the project team at phil_adams@us.ibm.com. All
58+
reported by contacting the project team at devxsdk@us.ibm.com. All
5959
complaints will be reviewed and investigated and will result in a response that
6060
is deemed necessary and appropriate to the circumstances. The project team is
6161
obligated to maintain confidentiality with regard to the reporter of an incident.

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ please ask a question at
55

66
# Issues
77
If you encounter an issue with the SDK, you are welcome to submit
8-
a [bug report](https://github.com/IBM/code-engine-node-sdk/issues).
8+
a [bug report](<github-repo-url>/issues).
99
Before that, please search for similar issues. It's possible someone has
1010
already encountered this issue.
1111

1212
# General Information
1313
For general guidance on contributing to this project, please see
14-
[this link](https://github.com/IBM/ibm-cloud-sdk-common/blob/master/CONTRIBUTING_nodejs.md)
14+
[this link](https://github.com/IBM/ibm-cloud-sdk-common/blob/main/CONTRIBUTING_nodejs.md)

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
# NodeJS SDK for IBM Cloud Code Engine
88
Node.js client library to interact with the [Code Engine API](https://cloud.ibm.com/apidocs/codeengine).
99

10-
Disclaimer: this SDK is being released initially as a **pre-release** version.
11-
Changes might occur which impact applications that use this SDK.
12-
1310
## Table of Contents
1411

1512
<!--
@@ -43,7 +40,9 @@ The IBM Cloud Code Engine Node.js SDK allows developers to programmatically inte
4340

4441
Service Name | Import Path
4542
--- | ---
46-
[Code Engine](https://cloud.ibm.com/apidocs/codeengine) | ibm-code-engine-sdk/ibm-cloud-code-engine/v1
43+
[Code Engine](https://cloud.ibm.com/apidocs/codeengine) |
44+
[Code Engine](https://cloud.ibm.com/apidocs/codeengine/codeengine-v2.0.0) | @ibm-cloud/@ibm-cloud/ibm-code-engine-sdk/code-engine/v2
45+
[Code Engine](https://cloud.ibm.com/apidocs/codeengine/codeengine-v1.0.0) | ibm-code-engine-sdk/ibm-cloud-code-engine/v1
4746

4847
## Prerequisites
4948
* You need an [IBM Cloud][ibm-cloud-onboarding] account.
@@ -54,7 +53,7 @@ Service Name | Import Path
5453
## Installation
5554

5655
```sh
57-
npm install ibm-code-engine-sdk
56+
npm install @ibm-cloud/@ibm-cloud/ibm-code-engine-sdk
5857
```
5958

6059
## Using the SDK

0 commit comments

Comments
 (0)