6 Commits

Author SHA1 Message Date
dbff40819f 1.0.5 2020-07-08 00:48:45 +00:00
67822b36d3 fix(core): update 2020-07-08 00:48:45 +00:00
f1d348bb6a 1.0.4 2020-07-07 20:07:22 +00:00
fab41e358c fix(core): update 2020-07-07 20:07:21 +00:00
a878130d6c 1.0.3 2020-07-07 18:34:51 +00:00
c7d61bec0b fix(core): update 2020-07-07 18:34:50 +00:00
3 changed files with 36 additions and 10 deletions

20
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartparcel",
"version": "1.0.2",
"version": "1.0.5",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -1756,7 +1756,6 @@
"version": "4.17.8",
"resolved": "https://verdaccio.lossless.one/@types%2fexpress-serve-static-core/-/express-serve-static-core-4.17.8.tgz",
"integrity": "sha512-1SJZ+R3Q/7mLkOD9ewCBDYD2k0WyZQtWYqF/2VvoNN2/uhI49J9CDN4OAm+wGMA0DbArA4ef27xl4+JwMtGggw==",
"dev": true,
"requires": {
"@types/node": "*",
"@types/qs": "*",
@@ -1828,8 +1827,15 @@
"@types/node": {
"version": "10.17.26",
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-10.17.26.tgz",
"integrity": "sha512-myMwkO2Cr82kirHY8uknNRHEVtn0wV3DTQfkrjx17jmkstDRZ24gNUdl8AHXVyVclTYI/bNjgTPTAWvWLqXqkw==",
"dev": true
"integrity": "sha512-myMwkO2Cr82kirHY8uknNRHEVtn0wV3DTQfkrjx17jmkstDRZ24gNUdl8AHXVyVclTYI/bNjgTPTAWvWLqXqkw=="
},
"@types/parcel-bundler": {
"version": "1.12.1",
"resolved": "https://verdaccio.lossless.one/@types%2fparcel-bundler/-/parcel-bundler-1.12.1.tgz",
"integrity": "sha512-I7Cy3Uy/HqMa3E7dyPxTkiPFx0gi3bIQxAcZCP8v1vFx+esdVFgbZBnusa6VfoIeFk61/fnVl25RyYKgDHVLtw==",
"requires": {
"@types/express-serve-static-core": "*"
}
},
"@types/portscanner": {
"version": "2.1.0",
@@ -1854,14 +1860,12 @@
"@types/qs": {
"version": "6.9.3",
"resolved": "https://verdaccio.lossless.one/@types%2fqs/-/qs-6.9.3.tgz",
"integrity": "sha512-7s9EQWupR1fTc2pSMtXRQ9w9gLOcrJn+h7HOXw4evxyvVqMi4f+q7d2tnFe3ng3SNHjtK+0EzGMGFUQX4/AQRA==",
"dev": true
"integrity": "sha512-7s9EQWupR1fTc2pSMtXRQ9w9gLOcrJn+h7HOXw4evxyvVqMi4f+q7d2tnFe3ng3SNHjtK+0EzGMGFUQX4/AQRA=="
},
"@types/range-parser": {
"version": "1.2.3",
"resolved": "https://verdaccio.lossless.one/@types%2frange-parser/-/range-parser-1.2.3.tgz",
"integrity": "sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA==",
"dev": true
"integrity": "sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA=="
},
"@types/relateurl": {
"version": "0.2.28",

View File

@@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartparcel",
"version": "1.0.2",
"version": "1.0.5",
"private": false,
"description": "a wrapper for parcel",
"main": "dist_ts/index.js",
@@ -21,7 +21,8 @@
},
"dependencies": {
"@pushrocks/smartpath": "^4.0.3",
"parcel-bundler": "^1.12.4"
"parcel-bundler": "^1.12.4",
"@types/parcel-bundler": "^1.12.1"
},
"files": [
"ts/**/*",

View File

@@ -25,6 +25,9 @@ export class Parcel {
public options: plugins.parcel.ParcelOptions;
public entryFiles: string | string[] = plugins.path.join(process.cwd(), './html/index.html');
/**
* builds and serves
*/
public async start() {
const bundler = new plugins.parcel(this.entryFiles, this.options);
@@ -33,6 +36,24 @@ export class Parcel {
const bundle = await bundler.serve(3002);
}
/**
* just builds
*/
public async build() {
const bundler = new plugins.parcel(this.entryFiles, {
...this.options,
watch: false
});
// Run the bundler, this returns the main bundle
// Use the events if you're using watch mode as this promise will only trigger once and not for every rebuild
const bundle = await bundler.bundle().catch(e => {
console.error(e);
throw e;
});
}
constructor(fromArg: string | string[], outputDirArg: string, outputFileArg: string) {
this.entryFiles = fromArg;
this.options = {