Skip to content

Commit 94d731f

Browse files
fix: doctype option was not validated correctly (#3468)
1 parent 32acfe8 commit 94d731f

3 files changed

Lines changed: 27 additions & 45 deletions

File tree

.github/workflows/rollingversions-canary.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

.github/workflows/rollingversions.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Release
22
on:
3+
push:
4+
branches:
5+
- master
36
repository_dispatch:
47
types: [rollingversions_publish_approved]
58

@@ -21,18 +24,35 @@ jobs:
2124
- run: yarn prettier:check
2225
- run: yarn test
2326

27+
28+
publish-canary:
29+
runs-on: ubuntu-latest
30+
if: ${{ github.event_name == 'push' }}
31+
needs: test
32+
steps:
33+
- uses: actions/checkout@v2
34+
- uses: actions/setup-node@v1
35+
with:
36+
node-version: 24.x
37+
registry-url: 'https://registry.npmjs.org'
38+
- run: yarn install --frozen-lockfile
39+
- run: yarn build
40+
- run: npx rollingversions publish --canary $GITHUB_RUN_NUMBER
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
2444
publish:
2545
runs-on: ubuntu-latest
46+
if: ${{ github.event_name == 'repository_dispatch' }}
2647
needs: test
2748
steps:
2849
- uses: actions/checkout@v2
2950
- uses: actions/setup-node@v1
3051
with:
31-
node-version: 12.x
52+
node-version: 24.x
3253
registry-url: 'https://registry.npmjs.org'
3354
- run: yarn install --frozen-lockfile
3455
- run: yarn build
3556
- run: npx rollingversions publish
3657
env:
3758
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

packages/pug-code-gen/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ function Compiler(node, options) {
7272
);
7373
}
7474
if (
75-
this.doctype &&
76-
(this.doctype.includes('<') || this.doctype.includes('>'))
75+
this.options.doctype &&
76+
(this.options.doctype.includes('<') || this.options.doctype.includes('>'))
7777
) {
7878
throw new Error('Doctype can not contain "<" or ">"');
7979
}
@@ -209,7 +209,9 @@ Compiler.prototype = {
209209
*/
210210

211211
setDoctype: function(name) {
212-
this.doctype = doctypes[name.toLowerCase()] || '<!DOCTYPE ' + name + '>';
212+
this.doctype = doctypes.hasOwnProperty(name.toLowerCase())
213+
? doctypes[name.toLowerCase()]
214+
: '<!DOCTYPE ' + name + '>';
213215
this.terse = this.doctype.toLowerCase() == '<!doctype html>';
214216
this.xml = 0 == this.doctype.indexOf('<?xml');
215217
},

0 commit comments

Comments
 (0)