Skip to content
This repository has been archived by the owner on Nov 27, 2020. It is now read-only.

V2 #2

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

V2 #2

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions __tests__/fixtures/js/dist/_filelist.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"start":"start.f1ed5571f87447db4451.js"
}
1 change: 1 addition & 0 deletions __tests__/fixtures/js/dist/start.f1ed5571f87447db4451.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// js code here
3 changes: 3 additions & 0 deletions __tests__/index.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test.skip('can run a test', () => {
expect(true).toBe(true)
})
4 changes: 4 additions & 0 deletions client/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["@babel/preset-env", "@babel/preset-react"],
"plugins": ["@babel/plugin-proposal-class-properties"]
}
71 changes: 71 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next

# certs
.csr
.pem

# CSS files are compiled
public/styles.css
public/styles.css*

.DS_Store
39 changes: 39 additions & 0 deletions client/FileListPlugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
class FileListPlugin {
apply(compiler) {
// emit is asynchronous hook, tapping into it using tapAsync, you can use tapPromise/tap(synchronous) as well
compiler.hooks.emit.tapAsync('FileListPlugin', (compilation, callback) => {
// Create a header string for the generated file:
let filelist = '{\n'

// Loop through all compiled assets,
// adding a new line item for each filename.
let i = 0
for (let filename in compilation.assets) {
let chunk = compilation.chunks[i]

if (chunk && chunk.name) {
filelist += `\t"${chunk.name}":"${filename}"` + ',\n'
}

i++
}

filelist = filelist.replace(/,\s*$/, '\n')
filelist += '}'

// Insert this list into the webpack build as a new file asset:
compilation.assets['_filelist.json'] = {
source: function() {
return filelist
},
size: function() {
return filelist.length
},
}

callback()
})
}
}

module.exports = FileListPlugin
10 changes: 10 additions & 0 deletions client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
```
npm run build
```
or

```
yarn build
```

to bundle the application
Loading