forked from vercel/pkg
-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add
ignore
option to ignore files from build (#68)
- Loading branch information
Showing
18 changed files
with
184 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { PkgOptions } from './types'; | ||
|
||
class Options { | ||
private options: PkgOptions; | ||
|
||
constructor() { | ||
this.options = { | ||
dictionary: {}, | ||
}; | ||
} | ||
|
||
public set(options: PkgOptions): void { | ||
this.options = options ?? this.options; | ||
} | ||
|
||
public get(): PkgOptions { | ||
return this.options; | ||
} | ||
} | ||
|
||
const options = new Options(); | ||
|
||
export default options; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
!node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/usr/bin/env node | ||
|
||
'use strict'; | ||
|
||
const path = require('path'); | ||
const assert = require('assert'); | ||
const utils = require('../utils.js'); | ||
const standard = 'stdout'; | ||
|
||
assert(!module.parent); | ||
assert(__dirname === process.cwd()); | ||
|
||
const target = process.argv[2] || 'host'; | ||
const output = './test-output.exe'; | ||
|
||
let left, right; | ||
utils.mkdirp.sync(path.dirname(output)); | ||
|
||
left = utils.spawn.sync('node', ['test-x-index.js']); | ||
|
||
const inspect = | ||
standard === 'stdout' | ||
? ['inherit', 'pipe', 'inherit'] | ||
: ['inherit', 'inherit', 'pipe']; | ||
|
||
const log = utils.pkg.sync( | ||
['--target', target, '--output', output, '.', '--debug'], | ||
inspect, | ||
); | ||
|
||
assert( | ||
log.indexOf('useless.c due to top level config ignore pattern') > 0, | ||
'useless.c file is not ignored', | ||
); | ||
assert( | ||
log.indexOf( | ||
'needed.c is added to queue', | ||
'needed.c file is not added to queue', | ||
), | ||
); | ||
|
||
right = utils.spawn.sync('./' + path.basename(output), [], { | ||
cwd: path.dirname(output), | ||
}); | ||
|
||
assert.strictEqual(left, right); | ||
utils.vacuum.sync(output); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"bin": "test-x-index.js", | ||
"license": "MIT", | ||
"dependencies": { | ||
"delta": "*" | ||
}, | ||
"pkg": { | ||
"ignore": [ | ||
"**/*/node_modules/delta/useless.c" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use strict'; | ||
|
||
var dataPath = 'delta'; | ||
require(dataPath); | ||
console.log(global.FOO); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.