Skip to content

Commit

Permalink
fix sw update
Browse files Browse the repository at this point in the history
  • Loading branch information
flyingeek committed Feb 8, 2024
1 parent 9dc41a6 commit 5d1b70f
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.3.6] - 2024-02-08
## [1.3.7] - 2024-02-08

### Fixed

Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "flytax",
"version": "1.3.6",
"patchVersion": "b",
"version": "1.3.7",
"type": "module",
"scripts": {
"build": "rollup -c",
Expand Down
3 changes: 1 addition & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import copy from 'rollup-plugin-copy';
import replace from '@rollup/plugin-replace';
const {markdown} = require('svelte-preprocess-markdown');
const workbox = require('rollup-plugin-workbox-inject');
import {version, patchVersion} from './package.json';
import {version} from './package.json';
import watchAssets from 'rollup-plugin-watch-assets';
import html from '@open-wc/rollup-plugin-html';
import {DATASET} from './src/stores';
Expand All @@ -27,7 +27,6 @@ const relPath = (url) => url.replace('./', './public/'); // public path for a lo

const U = {
'APP_VERSION': version,
'PATCH_VERSION': patchVersion,
'process.env.NODE_ENV': (production) ? JSON.stringify('production') : JSON.stringify('development'),
'CONF_PDFJS_WORKER_JS': 'https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.4.456/pdf.worker.min.js',
'CONF_PDFJS_JS': 'https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.4.456/pdf.min.js',
Expand Down
8 changes: 5 additions & 3 deletions scripts/makeData.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,13 @@ import fs from 'fs';
import got from 'got';
import iconv from 'iconv-lite';

//ugly
const patchVersion = JSON.parse(fs.readFileSync('package.json', 'utf8')).patchVersion;

const scriptArgs = process.argv.slice(2);
const year = (scriptArgs.length === 1) ? scriptArgs[0] : new Date().getFullYear().toString();
const isoStart = `${year}-01-01`;
const isoEnd = `${year}-12-31`;
const monthsfr = ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'];
const dataPath = `./data/data${year}.json`;

const csvPath = `./data/flytax-baremes${year}.csv`;
const WebpaysURL = "https://www.economie.gouv.fr/dgfip/fichiers_taux_chancellerie/txt/Webpays";
const WebmissURL = "https://www.economie.gouv.fr/dgfip/fichiers_taux_chancellerie/txt/Webmiss";
Expand Down Expand Up @@ -328,6 +326,10 @@ const save = (data) => {
log(`Saved ${dataPath}`, "green");
}
});
let patchVersion = '';
if (year === "2023") {
patchVersion = 'b'; //also edit stores.js
}
if (patchVersion) {
const dataPathPatched = dataPath.replace('.json', `${patchVersion}.json`);
fs.writeFile(dataPathPatched, JSON.stringify(data), (err) => {
Expand Down
6 changes: 3 additions & 3 deletions src/stores.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ export const BASES = [
{label: "Paris", selected: true, value: ['CDG', 'ORY'], tzConverter: iso2FR},
{label: "Toulouse", selected: false, value: ['TLS'], tzConverter: iso2FR}
].sort((a, b) => (a.label.localeCompare(b.label)));
const patchVersion = "PATCH_VERSION";

export const DATASET = [
{label: "2024", selected: false, url: `./data/data2023${patchVersion}.json`},
{label: "2023", selected: true, url: `./data/data2023${patchVersion}.json`},
{label: "2024", selected: false, url: `./data/data2023b.json`},
{label: "2023", selected: true, url: `./data/data2023b.json`}, // see save method in makeData
{label: "2022", selected: false, url: "./data/data2022.json"},
{label: "2021", selected: false, url: "./data/data2021.json"},
{label: "2020", selected: false, url: "./data/data2020.json"},
Expand Down
2 changes: 1 addition & 1 deletion src/sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ registerRoute(
})
);
registerRoute(
({ url }) => url.pathname.match(/\/data\/data[0-9]{4}\.json/),
({ url }) => url.pathname.match(/\/data\/data[0-9]{4}.?\.json/),
new CacheFirst({
cacheName: dataCacheName,
plugins: [
Expand Down

0 comments on commit 5d1b70f

Please sign in to comment.