Skip to content

Commit 471336e

Browse files
committed
chore: publish v2.0.0
close #8 #9 #10
1 parent e109aee commit 471336e

File tree

4 files changed

+84
-47
lines changed

4 files changed

+84
-47
lines changed

package-lock.json

Lines changed: 60 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/build.js

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,34 @@
1-
const rollup = require('rollup')
2-
const typescript = require('@rollup/plugin-typescript')
3-
const { terser } = require('rollup-plugin-terser')
4-
const banner = require('./banner')
5-
const fs = require('fs')
6-
7-
8-
compile('src/index.ts')
9-
compile('src/vuex.ts')
10-
compile('src/vue-router.ts')
11-
copyFile('package.json')
12-
copyFile('README.md')
13-
copyFile('LICENSE')
1+
const rollup = require('rollup');
2+
const typescript = require('@rollup/plugin-typescript');
3+
const { terser } = require('rollup-plugin-terser');
4+
const banner = require('./banner');
5+
const fs = require('fs');
146

7+
(async () => {
8+
await compile('src/index.ts');
9+
compile('src/vuex.ts');
10+
compile('src/vue-router.ts');
11+
copyFile('package.json');
12+
copyFile('README.md');
13+
copyFile('LICENSE');
14+
})();
1515

1616
async function compile(file) {
1717
const bundle = await rollup.rollup({
1818
input: file,
19-
external: [
20-
'vue',
21-
'vuex',
22-
'vue-router',
23-
],
24-
plugins: [
25-
typescript(),
26-
terser(),
27-
],
28-
})
19+
external: ['vue', 'vuex', 'vue-router'],
20+
plugins: [typescript(), terser()],
21+
});
2922
await bundle.write({
3023
dir: 'dist',
3124
banner,
3225
format: 'esm',
3326
sourcemap: true,
34-
})
27+
});
3528
}
3629

3730
function copyFile(file) {
38-
fs.copyFile(file, `dist/${file}`, err => {
31+
fs.copyFile(file, `dist/${file}`, (err) => {
3932
if (err) console.log(err);
40-
})
41-
}
33+
});
34+
}

src/utils.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
export const { warn } = console
1+
export const { warn } = console;
22

3-
export const OUT_OF_SCOPE = 'getCurrentInstance() returned null. Method must be called at the top of a setup function'
3+
export const OUT_OF_SCOPE =
4+
'method can only be used inside setup() or functional components';

src/vuex.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ export function useStore<S = any>(): Store<S> {
1111
const inst = getCurrentInstance();
1212
if (inst) {
1313
return inst.proxy.$store;
14-
} else {
15-
warn(OUT_OF_SCOPE);
1614
}
15+
warn(OUT_OF_SCOPE);
1716
return undefined as any;
1817
}

0 commit comments

Comments
 (0)