@runnerpro/backend 0.0.0-development
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +29 -0
- package/lib/cjs/HelloWorld/index.js +11 -0
- package/lib/cjs/index.js +13 -0
- package/lib/cjs/package.json +67 -0
- package/lib/cjs/types/HelloWorld/index.d.ts +6 -0
- package/lib/cjs/types/HelloWorld/index.d.ts.map +1 -0
- package/lib/cjs/types/index.d.ts +6 -0
- package/lib/cjs/types/index.d.ts.map +1 -0
- package/lib/esm/HelloWorld/index.js +7 -0
- package/lib/esm/index.mjs +9 -0
- package/lib/esm/types/HelloWorld/index.d.ts +6 -0
- package/lib/esm/types/HelloWorld/index.d.ts.map +1 -0
- package/lib/esm/types/index.d.ts +6 -0
- package/lib/esm/types/index.d.ts.map +1 -0
- package/package.json +71 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Snyk Labs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# modern-npm-package
|
|
2
|
+
|
|
3
|
+
An npm package for demonstration purposes using TypeScript to build for both the ECMAScript Module format (i.e. ESM or ES Module) and CommonJS Module format (CJS). It can be used in Node.js and browser applications.
|
|
4
|
+
|
|
5
|
+
## Get Started
|
|
6
|
+
|
|
7
|
+
1. Run `npm install` in your terminal
|
|
8
|
+
1. Then run `npm run build`
|
|
9
|
+
1. Update the `package.json` file "name" field with your own package name. Example `@username/package-name`
|
|
10
|
+
1. Create an account with [npm](https://www.npmjs.com/signup) if you don't have one already. Also be sure to enable [two-factor authentication](https://docs.npmjs.com/configuring-two-factor-authentication)
|
|
11
|
+
1. Sign in to your npm account in your terminal with `npm login`
|
|
12
|
+
1. Run `npm publish --access=public` to publish your package
|
|
13
|
+
|
|
14
|
+
### Testing
|
|
15
|
+
|
|
16
|
+
1. Install developer dependencies using the following command in your terminal `npm i -D mocha @types/mocha chai @types/chai ts-node`
|
|
17
|
+
1. Create a new file `.mocharc.json` in the root directory with the following contents:
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"extension": ["ts"],
|
|
21
|
+
"spec": "./**/*.spec.ts",
|
|
22
|
+
"require": "ts-node/register"
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
1. Create a `tests` folder
|
|
26
|
+
1. Create an `index.spec.ts` file in the `tests` folder
|
|
27
|
+
1. Write unit tests in the `index.spec.ts` file to test the code in `index.ts`
|
|
28
|
+
1. Add a `"test"` property in the `package.json` file and give it a value of `"mocha"`
|
|
29
|
+
1. Run `npm test` in your terminal from the root folder of the project
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.helloWorld = void 0;
|
|
4
|
+
function helloWorld() {
|
|
5
|
+
const message = 'Hello World from my example modern npm package!';
|
|
6
|
+
return message;
|
|
7
|
+
}
|
|
8
|
+
exports.helloWorld = helloWorld;
|
|
9
|
+
exports.default = {
|
|
10
|
+
helloWorld,
|
|
11
|
+
};
|
package/lib/cjs/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.goodBye = void 0;
|
|
4
|
+
function goodBye() {
|
|
5
|
+
const message = 'Goodbye from my example modern npm package!';
|
|
6
|
+
return message;
|
|
7
|
+
}
|
|
8
|
+
exports.goodBye = goodBye;
|
|
9
|
+
exports.default = {
|
|
10
|
+
goodBye,
|
|
11
|
+
};
|
|
12
|
+
// export { default as NotificationToClient } from './NotificationToClient';
|
|
13
|
+
// export * from './NotificationToClient';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "runnerpro-common-backend",
|
|
3
|
+
"version": "0.0.5-development",
|
|
4
|
+
"description": "A collection of common backend functions",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"require": {
|
|
8
|
+
"types": "./types/index.d.ts",
|
|
9
|
+
"default": "./index.js"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"types": "./types/index.d.ts",
|
|
14
|
+
"main": "./index.js",
|
|
15
|
+
"files": [
|
|
16
|
+
"**/*"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"clean": "del-cli ./lib",
|
|
20
|
+
"build": "npm run clean && npm run build:esm && npm run build:cjs",
|
|
21
|
+
"build:esm": "tsc -p ./configs/tsconfig.esm.json && move-file lib/esm/index.js lib/esm/index.mjs",
|
|
22
|
+
"build:cjs": "tsc -p ./configs/tsconfig.cjs.json",
|
|
23
|
+
"test": "mocha",
|
|
24
|
+
"semantic-release": "semantic-release"
|
|
25
|
+
},
|
|
26
|
+
"release": {
|
|
27
|
+
"branches": [
|
|
28
|
+
"main"
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
},
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "https://gitlab.com/runner-pro/commons.git"
|
|
37
|
+
},
|
|
38
|
+
"keywords": [
|
|
39
|
+
"npm",
|
|
40
|
+
"javascript",
|
|
41
|
+
"typescript",
|
|
42
|
+
"esm",
|
|
43
|
+
"cjs",
|
|
44
|
+
"nodejs",
|
|
45
|
+
"commonjs",
|
|
46
|
+
"ecmascript",
|
|
47
|
+
"beginner",
|
|
48
|
+
"example",
|
|
49
|
+
"demonstration"
|
|
50
|
+
],
|
|
51
|
+
"author": "Runner Pro",
|
|
52
|
+
"license": "MIT",
|
|
53
|
+
"bugs": {
|
|
54
|
+
"url": "https://gitlab.com/runner-pro/commons/-/issues"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@types/chai": "^4.3.3",
|
|
58
|
+
"@types/mocha": "^9.1.1",
|
|
59
|
+
"chai": "^4.3.6",
|
|
60
|
+
"del-cli": "^5.0.0",
|
|
61
|
+
"mocha": "^10.0.0",
|
|
62
|
+
"move-file-cli": "^3.0.0",
|
|
63
|
+
"semantic-release": "^19.0.3",
|
|
64
|
+
"ts-node": "^10.9.1",
|
|
65
|
+
"typescript": "^4.7.4"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/HelloWorld/index.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,WAGzB;;;;AAED,wBAEE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,wBAAgB,OAAO,WAGtB;;;;AAED,wBAEE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function goodBye() {
|
|
2
|
+
const message = 'Goodbye from my example modern npm package!';
|
|
3
|
+
return message;
|
|
4
|
+
}
|
|
5
|
+
export default {
|
|
6
|
+
goodBye,
|
|
7
|
+
};
|
|
8
|
+
// export { default as NotificationToClient } from './NotificationToClient';
|
|
9
|
+
// export * from './NotificationToClient';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/HelloWorld/index.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,WAGzB;;;;AAED,wBAEE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,wBAAgB,OAAO,WAGtB;;;;AAED,wBAEE"}
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@runnerpro/backend",
|
|
3
|
+
"version": "0.0.0-development",
|
|
4
|
+
"description": "A collection of common backend functions",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"import": {
|
|
8
|
+
"types": "./lib/esm/types/index.d.ts",
|
|
9
|
+
"default": "./lib/esm/index.mjs"
|
|
10
|
+
},
|
|
11
|
+
"require": {
|
|
12
|
+
"types": "./lib/cjs/types/index.d.ts",
|
|
13
|
+
"default": "./lib/cjs/index.js"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"types": "./lib/cjs/types/index.d.ts",
|
|
18
|
+
"main": "./lib/cjs/index.js",
|
|
19
|
+
"files": [
|
|
20
|
+
"lib/**/*"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"clean": "del-cli ./lib",
|
|
24
|
+
"build": "npm run clean && npm run build:esm && npm run build:cjs",
|
|
25
|
+
"build:esm": "tsc -p ./configs/tsconfig.esm.json && move-file lib/esm/index.js lib/esm/index.mjs",
|
|
26
|
+
"build:cjs": "tsc -p ./configs/tsconfig.cjs.json",
|
|
27
|
+
"test": "mocha",
|
|
28
|
+
"semantic-release": "semantic-release"
|
|
29
|
+
},
|
|
30
|
+
"release": {
|
|
31
|
+
"branches": [
|
|
32
|
+
"main"
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "https://gitlab.com/runner-pro/commons.git"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"npm",
|
|
44
|
+
"javascript",
|
|
45
|
+
"typescript",
|
|
46
|
+
"esm",
|
|
47
|
+
"cjs",
|
|
48
|
+
"nodejs",
|
|
49
|
+
"commonjs",
|
|
50
|
+
"ecmascript",
|
|
51
|
+
"beginner",
|
|
52
|
+
"example",
|
|
53
|
+
"demonstration"
|
|
54
|
+
],
|
|
55
|
+
"author": "Runner Pro",
|
|
56
|
+
"license": "MIT",
|
|
57
|
+
"bugs": {
|
|
58
|
+
"url": "https://gitlab.com/runner-pro/commons/-/issues"
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@types/chai": "^4.3.3",
|
|
62
|
+
"@types/mocha": "^9.1.1",
|
|
63
|
+
"chai": "^4.3.6",
|
|
64
|
+
"del-cli": "^5.0.0",
|
|
65
|
+
"mocha": "^10.0.0",
|
|
66
|
+
"move-file-cli": "^3.0.0",
|
|
67
|
+
"semantic-release": "^19.0.3",
|
|
68
|
+
"ts-node": "^10.9.1",
|
|
69
|
+
"typescript": "^4.7.4"
|
|
70
|
+
}
|
|
71
|
+
}
|