@code-dot-org/maze
Advanced tools
Comparing version 2.10.0 to 2.12.0
{ | ||
"name": "@code-dot-org/maze", | ||
"version": "2.10.0", | ||
"version": "2.12.0", | ||
"description": "standalone project for the Maze app type", | ||
@@ -5,0 +5,0 @@ "main": "dist/main.js", |
@@ -26,1 +26,34 @@ # maze | ||
yarn build | ||
### Publishing a new version | ||
In /maze: npm login with an authorized npm account. If necessary, create one under your own email, login with our shared dev account and add your new account to the org. After logging in, you may need to authorize your machine (follow the prompt given): | ||
npm login | ||
npm adduser (if necessary) | ||
Still in /maze: checkout main, and ensure it is up-to-date: | ||
git checkout main | ||
git pull | ||
Verify the existing code doesn't have errors or failing tests: | ||
yarn build | ||
yarn test | ||
Then, update the version (which also publishes to npm): | ||
npm version [major|minor|patch|premajor|preminor|prepatch]. | ||
Verify there is a new commit on /maze/main with the updated version number. | ||
In the @code-dot-org repo, incorporate the new version of maze: | ||
git checkout -b [maze-updates-we-are-incorporating] | ||
cd apps | ||
yarn add @code-dot-org/maze@my.new.version (ex: yarn add @code-dot-org/maze@2.7.0) | ||
Verify yarn.lock and package.json have been updated. | ||
Commit and push changes, and open and merge a PR. |
@@ -1,5 +0,6 @@ | ||
import Subtype from './subtype'; | ||
import NeighborhoodCell from './neighborhoodCell'; | ||
import NeighborhoodDrawer from './neighborhoodDrawer'; | ||
import { Direction } from './tiles'; | ||
import Subtype from "./subtype"; | ||
import NeighborhoodCell from "./neighborhoodCell"; | ||
import NeighborhoodSquareDrawer from "./neighborhoodSquareDrawer"; | ||
import NeighborhoodCircleDrawer from "./neighborhoodCircleDrawer"; | ||
import { Direction } from "./tiles"; | ||
@@ -13,2 +14,3 @@ module.exports = class Neighborhood extends Subtype { | ||
this.squareSize = this.skin_.squareSize; | ||
this.assetList = []; | ||
} | ||
@@ -22,3 +24,3 @@ | ||
} | ||
/** | ||
@@ -51,15 +53,19 @@ * @override | ||
if (asset) { | ||
// add asset id to the assetList | ||
this.assetList.push("tileElement" + `${tileId}-asset`); | ||
// add assset on top of blank tile if it exists | ||
// asset is in format {name: 'sample name', sheet: x, row: y, column: z} | ||
const assetHref = this.skin_.assetUrl(asset.sheet); | ||
const [sheetWidth, sheetHeight] = this.getDimensionsForSheet(asset.sheet); | ||
const [sheetWidth, sheetHeight] = this.getDimensionsForSheet( | ||
asset.sheet | ||
); | ||
this.drawer.drawTileHelper( | ||
svg, | ||
[asset.column, asset.row], | ||
row, | ||
col, | ||
`${tileId}-asset`, | ||
svg, | ||
[asset.column, asset.row], | ||
row, | ||
col, | ||
`${tileId}-asset`, | ||
assetHref, | ||
sheetWidth, | ||
sheetHeight, | ||
sheetWidth, | ||
sheetHeight, | ||
this.squareSize | ||
@@ -73,7 +79,23 @@ ); | ||
/** | ||
* @override | ||
**/ | ||
createDrawer(svg) { | ||
this.drawer = new NeighborhoodDrawer(this.maze_.map, this.skin_, svg, this.squareSize, this); | ||
/** | ||
* @override | ||
**/ | ||
createDrawer(svg, drawer = "square") { | ||
if (drawer === "square") { | ||
this.drawer = new NeighborhoodSquareDrawer( | ||
this.maze_.map, | ||
this.skin_, | ||
svg, | ||
this.squareSize, | ||
this | ||
); | ||
} else { | ||
this.drawer = new NeighborhoodCircleDrawer( | ||
this.maze_.map, | ||
this.skin_, | ||
svg, | ||
this.squareSize, | ||
this | ||
); | ||
} | ||
} | ||
@@ -84,5 +106,5 @@ | ||
* @param {String} pegmanId | ||
* @param {String} color Color to paint current location. | ||
* @param {String} color Color to paint current location. | ||
* Must be hex code or html color. | ||
**/ | ||
**/ | ||
addPaint(pegmanId, color) { | ||
@@ -95,2 +117,3 @@ const col = this.maze_.getPegmanX(pegmanId); | ||
this.drawer.updateItemImage(row, col, true); | ||
this.drawer.drawAssets(); | ||
} | ||
@@ -101,4 +124,4 @@ | ||
* @param {String} pegmanId | ||
**/ | ||
removePaint(pegmanId) { | ||
**/ | ||
removePaint(pegmanId) { | ||
const col = this.maze_.getPegmanX(pegmanId); | ||
@@ -109,2 +132,3 @@ const row = this.maze_.getPegmanY(pegmanId); | ||
this.drawer.updateItemImage(row, col, true); | ||
this.drawer.drawAssets(); | ||
} | ||
@@ -157,2 +181,7 @@ | ||
} | ||
} | ||
// Retrieve the asset list | ||
getAssetList() { | ||
return this.assetList; | ||
} | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
1474045
96
7576
59
0