@cycjimmy/hello-github-package-npm 5.0.2 → 6.2.0
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/.babelrc +8 -0
- package/.browserslistrc +12 -0
- package/.editorconfig +12 -0
- package/.eslintignore +3 -0
- package/.eslintrc +9 -0
- package/.gitattributes +2 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +41 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +17 -0
- package/.github/dependabot.yml +11 -0
- package/.github/workflows/coveralls.yml +35 -0
- package/.github/workflows/deploy2GhPages.yml +30 -0
- package/.github/workflows/nodeTestCI.yml +59 -0
- package/.github/workflows/release.yml +93 -0
- package/CODE_OF_CONDUCT.md +76 -0
- package/CONTRIBUTING.md +2 -0
- package/LICENSE +1 -1
- package/__mocks__/fileMock.mjs +1 -0
- package/__mocks__/styleMock.mjs +1 -0
- package/__test__/index.test.js +8 -0
- package/dist/{hello-world.cjs.js → hello-world.cjs} +0 -0
- package/dist/hello-world.umd.min.js +2 -2
- package/docs/CHANGELOG.md +566 -0
- package/jest.config.js +16 -0
- package/package.json +35 -30
- package/release.config.cjs +17 -0
- package/rollup/package.cjs +1 -0
- package/rollup/rollup.common.mjs +47 -0
- package/rollup/rollup.config.dev.mjs +41 -0
- package/rollup/rollup.config.prod.mjs +28 -0
- package/src/index.js +14 -0
- package/src/styles/index.scss +22 -0
- package/src/template/helloTemplate.js +5 -0
- package/static/favicon.ico +0 -0
- package/static/index.html +17 -0
- package/tasks/copyFiles.js +26 -0
- package/tasks/handlePackageJson.js +47 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true}] */
|
|
2
|
+
const makeCommonConfig = require('@cycjimmy/config-lib/cjs/semanticRelease/15.x/makeCommonConfig.cjs')
|
|
3
|
+
.default;
|
|
4
|
+
const pkg = require('./package.json');
|
|
5
|
+
|
|
6
|
+
module.exports = makeCommonConfig({
|
|
7
|
+
githubOptions: {
|
|
8
|
+
assets: [pkg.browser],
|
|
9
|
+
},
|
|
10
|
+
exec: true,
|
|
11
|
+
execOptions: {
|
|
12
|
+
prepareCmd: 'npm run package',
|
|
13
|
+
},
|
|
14
|
+
npmOptions: {
|
|
15
|
+
pkgRoot: 'package',
|
|
16
|
+
},
|
|
17
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../package.json');
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true}] */
|
|
2
|
+
/* eslint import/extensions: ["error", "ignorePackages", {"js": off}] */
|
|
3
|
+
import eslint from '@rollup/plugin-eslint';
|
|
4
|
+
import json from '@rollup/plugin-json';
|
|
5
|
+
import resolve from '@rollup/plugin-node-resolve';
|
|
6
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
7
|
+
import { babel } from '@rollup/plugin-babel';
|
|
8
|
+
import postcss from 'rollup-plugin-postcss';
|
|
9
|
+
import autoprefixer from 'autoprefixer';
|
|
10
|
+
import { terser } from 'rollup-plugin-terser';
|
|
11
|
+
|
|
12
|
+
import myBanner from '@cycjimmy/config-lib/esm/chore/myBanner.js';
|
|
13
|
+
import terserOption from '@cycjimmy/config-lib/esm/terser/4.x/production.js';
|
|
14
|
+
|
|
15
|
+
import pkg from './package.cjs';
|
|
16
|
+
|
|
17
|
+
export const IS_DEVELOPMENT = process.env.NODE_ENV === 'development';
|
|
18
|
+
export const IS_PRODUCTION = process.env.NODE_ENV === 'production';
|
|
19
|
+
export const IS_DEPLOYMENT = process.env.NODE_ENV === 'deployment';
|
|
20
|
+
|
|
21
|
+
export const input = './src/index.js';
|
|
22
|
+
export const name = 'helloWorld';
|
|
23
|
+
export const banner = myBanner(pkg);
|
|
24
|
+
|
|
25
|
+
export const plugins = [
|
|
26
|
+
json(),
|
|
27
|
+
postcss({
|
|
28
|
+
modules: {
|
|
29
|
+
generateScopedName: IS_PRODUCTION ? '[hash:base64:10]' : '[name]__[local]',
|
|
30
|
+
},
|
|
31
|
+
autoModules: false,
|
|
32
|
+
minimize: true,
|
|
33
|
+
plugins: [autoprefixer],
|
|
34
|
+
}),
|
|
35
|
+
eslint({
|
|
36
|
+
fix: true,
|
|
37
|
+
exclude: [
|
|
38
|
+
'node_modules/**',
|
|
39
|
+
'**/*.(css|scss)',
|
|
40
|
+
],
|
|
41
|
+
}),
|
|
42
|
+
resolve(),
|
|
43
|
+
babel({ babelHelpers: 'bundled' }),
|
|
44
|
+
commonjs(),
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
export const terserPlugins = IS_PRODUCTION && terser(terserOption);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true}] */
|
|
2
|
+
/* eslint import/extensions: ["error", "ignorePackages", {"mjs": off}] */
|
|
3
|
+
import browsersync from 'rollup-plugin-browsersync';
|
|
4
|
+
import copy from 'rollup-plugin-copy';
|
|
5
|
+
|
|
6
|
+
import pkg from './package.cjs';
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
input, IS_DEVELOPMENT, IS_DEPLOYMENT, name, plugins,
|
|
10
|
+
} from './rollup.common.mjs';
|
|
11
|
+
|
|
12
|
+
export default [
|
|
13
|
+
{
|
|
14
|
+
input,
|
|
15
|
+
output: {
|
|
16
|
+
name,
|
|
17
|
+
file: pkg.browser.replace('.min.js', '.js'),
|
|
18
|
+
format: 'umd',
|
|
19
|
+
exports: 'default',
|
|
20
|
+
},
|
|
21
|
+
plugins: [
|
|
22
|
+
...plugins,
|
|
23
|
+
|
|
24
|
+
IS_DEPLOYMENT
|
|
25
|
+
&& copy({
|
|
26
|
+
hook: 'writeBundle',
|
|
27
|
+
targets: [
|
|
28
|
+
{
|
|
29
|
+
src: ['static/**/*', 'dist/**.umd.js'],
|
|
30
|
+
dest: '.publish',
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
}),
|
|
34
|
+
IS_DEVELOPMENT
|
|
35
|
+
&& browsersync({
|
|
36
|
+
server: ['static', 'dist'],
|
|
37
|
+
watch: true,
|
|
38
|
+
}),
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/* eslint import/extensions: ["error", "ignorePackages", {"mjs": off}] */
|
|
2
|
+
import pkg from './package.cjs';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
banner, input, name, plugins, terserPlugins,
|
|
6
|
+
} from './rollup.common.mjs';
|
|
7
|
+
|
|
8
|
+
export default [
|
|
9
|
+
{
|
|
10
|
+
input,
|
|
11
|
+
output: [
|
|
12
|
+
{ file: pkg.main, format: 'cjs', exports: 'default' },
|
|
13
|
+
{ file: pkg.module, format: 'es', exports: 'default' },
|
|
14
|
+
],
|
|
15
|
+
plugins,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
input,
|
|
19
|
+
output: {
|
|
20
|
+
name,
|
|
21
|
+
file: pkg.browser,
|
|
22
|
+
format: 'umd',
|
|
23
|
+
banner,
|
|
24
|
+
exports: 'default',
|
|
25
|
+
},
|
|
26
|
+
plugins: [...plugins, terserPlugins],
|
|
27
|
+
},
|
|
28
|
+
];
|
package/src/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import helloTemplate from './template/helloTemplate';
|
|
2
|
+
import _style from './styles/index.scss';
|
|
3
|
+
|
|
4
|
+
const helloWorld = () => 'hello world!';
|
|
5
|
+
const helloElement = helloTemplate({
|
|
6
|
+
message: 'hello world!',
|
|
7
|
+
_style,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
helloWorld,
|
|
12
|
+
helloElement,
|
|
13
|
+
_style,
|
|
14
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
@import "~@cycjimmy/sass-lib";
|
|
2
|
+
|
|
3
|
+
%blackBorder {
|
|
4
|
+
border: 1px solid black;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.helloWrapper {
|
|
8
|
+
@extend %flexCenter;
|
|
9
|
+
width: 500px;
|
|
10
|
+
height: 300px;
|
|
11
|
+
margin: auto;
|
|
12
|
+
|
|
13
|
+
@extend %blackBorder;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.hello {
|
|
17
|
+
@extend %flexCenter;
|
|
18
|
+
width: 80%;
|
|
19
|
+
height: 80%;
|
|
20
|
+
|
|
21
|
+
@extend %blackBorder;
|
|
22
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
|
|
6
|
+
<link rel="shortcut icon" href="./favicon.ico">
|
|
7
|
+
<title>Hello World</title>
|
|
8
|
+
</head>
|
|
9
|
+
|
|
10
|
+
<body>
|
|
11
|
+
<script src="./hello-world.umd.js"></script>
|
|
12
|
+
<script>
|
|
13
|
+
console.log(helloWorld);
|
|
14
|
+
document.body.innerHTML += helloWorld.helloElement;
|
|
15
|
+
</script>
|
|
16
|
+
</body>
|
|
17
|
+
</html>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true}] */
|
|
2
|
+
/* eslint no-console: 0 */
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import fs from 'fs-extra';
|
|
5
|
+
|
|
6
|
+
const { copy } = fs;
|
|
7
|
+
|
|
8
|
+
Promise.resolve()
|
|
9
|
+
.then(() => copy(
|
|
10
|
+
path.resolve('dist'),
|
|
11
|
+
path.resolve('package', 'dist'),
|
|
12
|
+
))
|
|
13
|
+
.then(() => copy(
|
|
14
|
+
path.resolve('README.md'),
|
|
15
|
+
path.resolve('package', 'README.md'),
|
|
16
|
+
))
|
|
17
|
+
.then(() => copy(
|
|
18
|
+
path.resolve('LICENSE'),
|
|
19
|
+
path.resolve('package', 'LICENSE'),
|
|
20
|
+
))
|
|
21
|
+
.then(() => {
|
|
22
|
+
console.log('copyFiles success!');
|
|
23
|
+
})
|
|
24
|
+
.catch((err) => {
|
|
25
|
+
console.error(err);
|
|
26
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true}] */
|
|
2
|
+
/* eslint no-console: 0 */
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import fs from 'fs-extra';
|
|
5
|
+
|
|
6
|
+
const { readJson, outputJson } = fs;
|
|
7
|
+
|
|
8
|
+
Promise.resolve()
|
|
9
|
+
.then(() => readJson(
|
|
10
|
+
path.resolve('package.json'),
|
|
11
|
+
))
|
|
12
|
+
.then((data) => {
|
|
13
|
+
const jsonData = data;
|
|
14
|
+
if (jsonData.scripts) {
|
|
15
|
+
delete jsonData.scripts;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (jsonData.dependencies) {
|
|
19
|
+
delete jsonData.dependencies;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (jsonData.devDependencies) {
|
|
23
|
+
delete jsonData.devDependencies;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (jsonData.publishConfig) {
|
|
27
|
+
delete jsonData.publishConfig;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (jsonData.config) {
|
|
31
|
+
delete jsonData.config;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return outputJson(
|
|
35
|
+
path.resolve('package', 'package.json'),
|
|
36
|
+
jsonData,
|
|
37
|
+
{
|
|
38
|
+
spaces: 2,
|
|
39
|
+
},
|
|
40
|
+
);
|
|
41
|
+
})
|
|
42
|
+
.then(() => {
|
|
43
|
+
console.log('handlePackageJson success!');
|
|
44
|
+
})
|
|
45
|
+
.catch((err) => {
|
|
46
|
+
console.error(err);
|
|
47
|
+
});
|