Skip to content

Commit

Permalink
Remove parcel-plugin-text; inline our own variant
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominic Dagradi authored and Dominic Dagradi committed Dec 30, 2020
1 parent 342c40d commit 7f3d9b3
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 25 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module.exports = {
2,
{ allowString: false, allowNumber: false, allowNullableObject: false },
],
'@typescript-eslint/no-var-requires': 0,
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unnecessary-condition': 'error',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
Expand Down
6 changes: 0 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,8 @@
"glslify-deps": "^1.3.1",
"jest": "^26.0.1",
"parcel-bundler": "^1.12.4",
"parcel-plugin-text": "^0.9.7",
"prettier": "^2.0.5",
"ts-jest": "^26.1.0",
"typescript": "^3.8.3"
},
"parcel-plugin-text": {
"extensions": [
"obj"
]
}
}
14 changes: 14 additions & 0 deletions src/cli/build/TextAsset.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const { Asset } = require('parcel-bundler')

module.exports = class TextAsset extends Asset {
constructor(name, pkg, options) {
super(name, pkg, options)
this.type = 'js'
}

generate() {
const content = JSON.stringify(this.contents);

return [{ type: 'js', value: `module.exports = ${content}` }]
}
}
2 changes: 2 additions & 0 deletions src/cli/build/buildClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const bundler = new Bundler(path.join(gameSrcPath, 'index.html'), {
sourceMaps: true,
})

bundler.addAssetType('obj', require.resolve('./TextAsset'))

bundler.bundle().then(() => {
// do nothing
})
1 change: 1 addition & 0 deletions src/components/Bullet.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { vec2 } from 'gl-matrix'

import { TILE_SIZE } from '~/constants'
import { Immutable } from '~/types/immutable'

Expand Down
4 changes: 0 additions & 4 deletions src/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ const defaultColor = [1.0, 0, 1.0, 1.0]
export const getModel: (modelType: ModelTypes) => ModelDef = (modelType) => {
const obj = models[modelType]

console.log(modelType)

const vertices: number[] = []
const colors: number[] = []
const normals: number[] = []
Expand All @@ -51,8 +49,6 @@ export const getModel: (modelType: ModelTypes) => ModelDef = (modelType) => {
return
}

console.log('parsing line...', line)

const components = line.split(/\s+/)

if (components[0] === 'v') {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@
"out",
"node_modules"
]
}
}
15 changes: 1 addition & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2704,7 +2704,7 @@ [email protected], core-util-is@~1.0.0:
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=

cosmiconfig@^5.0.0, cosmiconfig@^5.0.2:
cosmiconfig@^5.0.0:
version "5.2.1"
resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-5.2.1.tgz#040f726809c591e77a17c0a3626ca45b4f168b1a"
integrity sha512-H65gsXo1SKjf8zmrJ67eJk8aIRKV5ff2D4uKZIBZShbhGSpEmsQOPW/SKMKYhSTrqR7ufy6RP69rPogdaPh/kA==
Expand Down Expand Up @@ -5608,11 +5608,6 @@ log-symbols@^2.2.0:
dependencies:
chalk "^2.0.1"

loglevel@^1.6.1:
version "1.7.1"
resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.7.1.tgz#005fde2f5e6e47068f935ff28573e125ef72f197"
integrity sha512-Hesni4s5UkWkwCGJMQGAh71PaLUmKFM60dHvq0zi/vDhhrzuk+4GgNbTXJ12YYQJn6ZKBDNIjYcuQGKudvqrIw==

loose-envify@^1.1.0, loose-envify@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
Expand Down Expand Up @@ -6306,14 +6301,6 @@ parcel-bundler@^1.12.4:
v8-compile-cache "^2.0.0"
ws "^5.1.1"

parcel-plugin-text@^0.9.7:
version "0.9.7"
resolved "https://registry.yarnpkg.com/parcel-plugin-text/-/parcel-plugin-text-0.9.7.tgz#826d32f4860d16e1915f61842f212f466aca9643"
integrity sha512-/YTROA74LHLDOnltAbbRYLJ6AkdIA+fLUmZBCE2knzUv0IyDrofl+il0hiA7/wmtut7XkuwIb+RxGWwSOgYiOA==
dependencies:
cosmiconfig "^5.0.2"
loglevel "^1.6.1"

parcel@^1.12.4:
version "1.12.4"
resolved "https://registry.yarnpkg.com/parcel/-/parcel-1.12.4.tgz#c8136085179c6382e632ca98126093e110be2ac5"
Expand Down

0 comments on commit 7f3d9b3

Please sign in to comment.